package com.book.common;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;

public class load {
    public static void loadPropByInputStream(){
        try (InputStream ips = new FileInputStream(new File("D:\\spring练习\\untitled1\\untitled\\src\\main\\resources\\license.properties"))) {
            Properties prop = new Properties();
            prop.load(ips);
            Enumeration enumeration =  prop.propertyNames();
            System.out.println("<-----load by stream----->");
            while(enumeration.hasMoreElements()){
                String key = (String)enumeration.nextElement();
                String value = prop.getProperty(key);
                System.out.println(key+":"+value);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
